<template>
  <el-button plain @click="dialogVisible = true">
    Click to open the Dialog
  </el-button>

  <el-dialog
      v-model="dialogVisible"
      title="Tips"
      width="500"
  >
    <upload-image v-model="data.imageUrl"
                  :image-limit="1"
                  image-path="test"
                  :is-compress="false"
                  service-file-root-path="http://127.0.0.1:8080/"
                  service-url="http://127.0.0.1:8080/file"/>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogVisible = false">Cancel</el-button>
        <el-button type="primary" @click="confirmClick">Confirm</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import UploadImage from '@/components/UploadImage.vue'
import { reactive, ref } from 'vue'

const dialogVisible = ref(false)

const data = reactive({
  imageUrl: 'files\\test\\image1.jpg'
})

const confirmClick = () => {
  console.log(data.imageUrl)
  dialogVisible.value = false
}
</script>
